<!doctype html>
<html>
<head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
    <meta name="referrer" content="no-referrer" />
    <style>
        html { height: 100% }
        body { height: 100%; margin: 0; padding: 0; background-color: #FFF }
        .xiumi { height: 100%; width: 100%; border: none}
    </style>
</head>
<body>
<div style="width:100%; height:100%">
    <iframe id="xiumi" class="xiumi" src="https://xiumi.us/studio/v5#/paper"></iframe>
</div>
<script>
    var salf;
    function setEdit(obj) {
        salf = obj;
    }
    var xiumi = document.getElementById('xiumi');
    var xiumi_url = 'https://xiumi.us';
    xiumi.onload = function () {
        console.log("postMessage");
        xiumi.contentWindow.postMessage('ready', xiumi_url);
    };
    window.addEventListener('message', function (event) {
        if (event.origin == xiumi_url) {
            salf.insertHtml(event.data).hideDialog().focus();
            salf.remoteImages();
        }
    }, false);
</script>
</body>
</html>